Page({
  data: {
    address: {},
    cart: [],
    totalPrice: 0,
    totalNum: 0
  },
  onShow() {
    let cart = wx.getStorageSync("cart")
    cart = cart.filter(v => v.check)
    let totalPrice = 0
    let totalNum = 0
    cart.forEach(v => {
      if (v.check) {
        totalPrice += v.goods_price * v.num
        totalNum += v.num
      }
    })
    this.setData({
      cart,
      totalPrice,
      totalNum
    })
    this.setData({
      address: wx.getStorageSync("address"),
    })
  },
})